<script type="text/javascript">
RED.nodes.registerType('SmartHome-Bot-Account', {
  category: 'config',
  defaults: {
    name: { value: '默认配置' }
  },
  credentials: {
    username: { type: 'text', required: true, value: '' },
    password: { type: 'password', required: true, value: '' }
  },
  label: function () {
    return this.name
  }
})
</script>

<script type="text/x-red" data-template-name="SmartHome-Bot-Account">
    <div class="form-row">
        <label for="node-config-input-name"><i class="fa fa-tag"></i>配置名称</label>
        <input type="text" id="node-config-input-name">
    </div>
    <div class="form-row">
        <label for="node-config-input-username"><i class="fa fa-tag"></i> Username</label>
        <input type="text" id="node-config-input-username" placeholder="Username">
    </div>
    <div class="form-row">
        <label for="node-config-input-password"><i class="fa fa-location-arrow"></i> Password</label>
        <input type="password" id="node-config-input-password" placeholder="Password">
    </div>
</script>

<script type="text/javascript">
    RED.nodes.registerType('SmartHome-Bot-Config', {
        category: 'config',
        defaults: {
            name: { type: 'text', required: true, value: '' },
            jsonConfig: { type: 'text', required: true, value: '' }
        },
        label: function () {
            return this.name
        }
    })
</script>

<script type="text/x-red" data-template-name="SmartHome-Bot-Config">
        <div class="form-row">
            <label for="node-config-input-name"><i class="fa fa-tag"></i> 名字</label>
            <input type="text" id="node-config-input-name" placeholder="设备类型配置信息"">
        </div>
        <div class="form-row">
            <label for="node-config-input-jsonConfig"><i class="icon-tag"></i>配置</label>
            <textarea type="text" id="node-config-input-jsonConfig" placeholder="指定设备类型的配置信息" style="width: 70%; height:200px;"></textarea>
          </div>
    </script>

    <script type="text/x-red" data-help-name="SmartHome-Bot-Config">
        <p></p>
    </script>

<script type="text/javascript">
    RED.nodes.registerType('SmartHome-Bot', {
        category: '泛艺-小爱',
        color: '#00c4ff',
        defaults: {
            name: { value: "" },
            account: { type: "SmartHome-Bot-Account", required: true },
            jsonConfig: { type: "SmartHome-Bot-Config", required: true },
            deviceId: { value: "", required: true},
            auto:{ value: false}
        },
        inputs: 0,
        outputs: 2,
        icon: "xiaoxi.svg",
        paletteLabel: function () {
            return "小爱-输入";
        },
        label: function () {
            return this.name || this.deviceId || '默认设备';
        }
    });
</script>

<script type="text/x-red" data-template-name="SmartHome-Bot">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-account"><i class="fa fa-tag"></i> Account</label>
        <input type="text" id="node-input-account" placeholder="Account">
    </div>
    <div class="form-row">
        <label for="node-input-jsonConfig"><i class="fa fa-tag"></i> 配置</label>
        <input type="text" id="node-input-jsonConfig" placeholder="指定设备类型配置信息">
    </div>
    <div class="form-row">
        <label for="node-input-deviceId"><i class="fa fa-cog"></i> DeviceId</label>
        <input type="text" id="node-input-deviceId">
    </div>
    <div class="form-row">
        <label style='width:100px;'><i class="fa fa-sign-in"></i> 控制自动反馈</label>
        <input type="checkbox" id="node-input-auto" style="display: inline-block; width: auto; vertical-align: top;">
      </div>
</script>

<script type="text/x-red" data-help-name="SmartHome-Bot">
    <p></p>
</script>

<script type="text/javascript">
    RED.nodes.registerType('SmartHome-Bot-End', {
        category: '泛艺-小爱',
        color: '#00c4ff',
        defaults: {
            name: { value: "" },
            account: { type: "SmartHome-Bot-Account", required: true }
        },
        inputs: 1,
        outputs: 0,
        icon: "xiaoxi.svg",
        paletteLabel: function () {
            return "小爱-输出"
        },
        label: function () {
            return this.name || this.deviceId || '默认输出';;
        }
    });
</script>

<script type="text/x-red" data-template-name="SmartHome-Bot-End">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-account"><i class="fa fa-tag"></i> Account</label>
        <input type="text" id="node-input-account" placeholder="Account">
    </div>

</script>

<script type="text/x-red" data-help-name="SmartHome-Bot-End">
    <p></p>
</script>


<script type="text/javascript">
    RED.nodes.registerType('BizWeChat-Bot', {
        category: '泛艺-小爱',
        color: '#00c4ff',
        defaults: {
            name: { value: "" },
            account: { type: "SmartHome-Bot-Account", required: true },
            address: { value: "", required: true}
        },
        inputs: 0,
        outputs: 0,
        icon: "oauth.svg",
        paletteLabel: function () {
            return "企业微信";
        },
        label: function () {
            return this.name || '默认企业微信';
        }
    });
</script>
<script type="text/x-red" data-template-name="BizWeChat-Bot">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-account"><i class="fa fa-tag"></i> Account</label>
        <input type="text" id="node-input-account" placeholder="Account">
    </div>

    <div class="form-row">
        <label for="node-input-address"><i class="fa fa-tag"></i>地址</label>
        <input type="text" id="node-input-address" placeholder="企业微信局域网访问地址(http://192.168.1.3:3000)">
    </div>

    <div class="form-row">
        <label style="width:100%;padding-left:100px;margin-top:50px;box-sizing: border-box;" >
          <a href="https://wx.zsxq.com/dweb2/index/group/51288182451214" target="_blank">加入知识星球计划你可以得到</a>
          <li>及时的问答服务</li>
          <li>小爱音响接入使用权</li>
          <li>企业微信推送透传服务</li>
          <li>最新的教程文章</li>
        </label>
    </div>
    
</script>

<script type="text/x-red" data-help-name="BizWeChat-Pushbear">
    <p></p>
</script>


<script type="text/javascript">
    RED.nodes.registerType('BizWeChat-Pushbear', {
        category: '泛艺-小爱',
        color: '#00c4ff',
        defaults: {
            name: { value: "" },
            account: { type: "SmartHome-Bot-Account", required: true },
            address: { value: "", required: true}
        },
        inputs: 0,
        outputs: 0,
        icon: "pushbear.svg",
        paletteLabel: function () {
            return "Pushbear";
        },
        label: function () {
            return this.name || 'Pushbear';
        }
    });
</script>
<script type="text/x-red" data-template-name="BizWeChat-Pushbear">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-account"><i class="fa fa-tag"></i> Account</label>
        <input type="text" id="node-input-account" placeholder="Account">
    </div>

    <div class="form-row">
        <label style="width:100%;padding-left:100px;margin-top:50px;box-sizing: border-box;" >
          <a href="https://wx.zsxq.com/dweb2/index/group/51288182451214" target="_blank">加入知识星球计划你可以得到</a>
          <li>及时的问答服务</li>
          <li>小爱音响接入使用权</li>
          <li>企业微信推送透传服务</li>
          <li>最新的教程文章</li>
        </label>
    </div>
    
</script>

<script type="text/x-red" data-help-name="BizWeChat-Pushbear">
    <p></p>
</script>
